<?php
include("include/cfg_login.php");

?>

<html>
	<head>
		<link href="css/style.css" rel="stylesheet">
		<link href="../css/start/jquery-ui-1.10.4.custom.css" rel="stylesheet">
	</head>
	<body>
		<div id="adminMenu">
			<?php include("include/menu.php"); ?>
		</div>
		<div id="content">
			<div id="contentWrap">
					<h1>Lista evenimente </h1>
					<table>
						<tr class="headTable" >
							<td>Eveniment</td>
							<td>Data</td>
						</tr>
						<?php
							$res =  mysql_query("SELECT *, (3959 * acos(cos(radians('46.0442')) * cos(radians(lat)) * cos(radians(lon) - radians('24.8871')) + sin(radians('46.0442')) * sin(radians(lat)))) AS distance FROM evenimente HAVING distance < 350 and  tip = 'M' and mag >= 3 order by data_eveniment desc limit 10");
							while($row = mysql_fetch_array($res)):
						?>
						<tr class="rowTable" href="/admin/eveniment.php?id=<?php echo $row['id_cutremur']; ?>">
							<td>Cutremur de : <font style="font-size:22px;color:orange;"><?php echo $row['mag']; ?></font> in <?php echo $row['regiune']; ?> </td>
							<td> 
							<?php 
								$data = explode(" ",$row['data_eveniment']); 
								$data_zi = $data[0];
								$data_ora = $data[1];
								echo  '<b style="color:gold">'. $data_ora . '</b> ' . $data_zi ; 
							?>

							</td>
						</tr>
						<?php endwhile; ?>
				</table>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> 
	<script src="../js/jquery-1.10.2.js"></script>
	<script src="../js/jquery-ui-1.10.4.custom.js"></script>
	<script>
		$(document).ready(function(){
			$('table tr').click(function(){
				window.location = $(this).attr('href');
				return false;
			});
		});
	</script>
</html>